// app.js
const AV = require('./libs/av-core-min.js');
const adapters = require('./libs/leancloud-adapters-weapp.js');
AV.setAdapters(adapters);
AV.init({
  appId: 'wKzxDAugb5NM5PGP18h0cTdj-gzGzoHsz',
  appKey: 'bhGqzeU5ctkGPjznoaPmuYTP',
  // 请将 xxx.example.com 替换为你的应用绑定的自定义 API 域名
  serverURLs: "https://wkzxdaug.lc-cn-n1-shared.com",
});

App({
  onLaunch() {
    var userInfo = wx.getStorageSync('userInfo');
    if (userInfo) {
      this.globalData.userInfo = userInfo;
    }
       // 登录
// this.my_login();
         // 获取顶部栏信息
    wx.getSystemInfo({
      success: res => {
        //导航高度
        this.globalData.navHeight = res.statusBarHeight + 46;
      }, fail(err) {
        console.log(err);
      }
    })
},

 /*my_login:function(){
    var that = this;
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        console.log('发送的code值:' +res.code)
        wx.request({
          url: that.globalData.baseurl + "api/login/",
          data: { "code": res.code },
          method: "POST",
          success(e) {
            console.log(res)
            wx.setStorageSync('token', e.data.data.token)
            wx.setStorageSync('sessionkey', e.data.data.session_key)
            console.log('后台返回的Token值:'+ e.data.data.token)
            console.log('后台返回的openID:'+ e.data.data.openId)
            console.log('后台返回的SessionKey:'+ e.data.data.session_key)
          }
        })
      }
    })
  },
*/
 
globalData: {
    userInfo: null,
    navHeight:0,
    baseurl: "http://127.0.0.1:8000/"
  }
})
